/* CPP Assignemnt 3 (COSC1152-2011-S2)
 * Elliott O'Dea-Joyce s3074110@student.rmit.edu.au
 * Ross Nye s9455459@student.rmit.edu.au
 */

#ifndef GRAPH_STRAT_H
#define GRAPH_STRAT_H



#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>

typedef std::pair<int, int> E;
typedef std::pair<float, float> V;


class GraphStrat
{
	public:
		GraphStrat() : v(NULL), e(NULL), w(NULL), numVertex(0) {};
		~GraphStrat();
		
		std::vector<V>* getVertex() { return v;};
		std::vector<E>* getEdges() { return e;};
		std::vector<float>* getWeights() { return w;};
		int getNumVertex() { return numVertex; };

		virtual void create(char* _filename) = 0;
		virtual const char* getStratName() = 0;

	protected:
		void setup_vertex(char* setup_string);
		void loadfile(char* _filename);
		void generate_vertex(char* num_string);
		
		std::vector<V>* v;
		std::vector<E>* e;
		std::vector<float>* w;
		int numVertex;
};

class CompleteGraph : public GraphStrat
{
	public:
		CompleteGraph() : GraphStrat() {};
	private:
		void create(char* _filename);
		const char* getStratName() { return "Complete"; };
};

class DelaunayGraph : public GraphStrat
{
	public:
		DelaunayGraph() : GraphStrat() {};
	private:
		void create(char* _filename);
		const char* getStratName() { return "Delaunay"; };
};


class MakeGraph
{
	private:
		GraphStrat* strat;
	
	public:
		MakeGraph(GraphStrat* _strat) : strat(_strat) {};
		~MakeGraph() { delete strat; };
	
		void create(char* filename) { strat->create(filename); };
		std::vector<V>* getVertex() { return strat->getVertex();};
		std::vector<E>* getEdges() { return strat->getEdges();};
		std::vector<float>* getWeights() { return strat->getWeights();};
		int getNumVertex()  { return strat->getNumVertex(); };
		int getNumEdges() { return strat->getEdges()->size(); };
		const char* getStratName() { return strat->getStratName(); };		
};


#endif
